import { catelist } from '../../api/api'

const state = {
  cateList: []

}
const getters = {
  getcatelist (state) {
    return state.cateList
  }

}
const mutations = {
  REQ_CATELIST (state, payload) {
    state.cateList = payload
  }

}
// 调用接口
const actions = {
  getCatelist ({ commit }) {
    catelist({ istree: 1 }).then(res => {
      console.log(res)
      commit('REQ_CATELIST', res.list)
    })
  }

}

export default {
// 命名空间
  namespaced: true,
  actions,
  mutations,
  getters,
  state
}
